import 'package:fish_redux/fish_redux.dart';
import 'package:flutter_work/list/component/state.dart';

import 'action.dart';
import 'state.dart';

Effect<ListPageState> buildEffect() {
  return combineEffects(<Object, Effect<ListPageState>>{
    ListPageAction.action: _onAction,
    Lifecycle.initState:_init
  });
}

void _onAction(Action action, Context<ListPageState> ctx) {
}

void _init(Action action, Context<ListPageState> ctx){
  ctx.state.datas.add(ItemComponentState(title:'开启isolate',index:0));
  ctx.state.datas.add(ItemComponentState(title:'关闭isolate',index:1));
  ctx.state.datas.add(ItemComponentState(title:'刷新界面',index:2));
  ctx.dispatch(ListPageActionCreator.initDatas(ctx.state.datas));
}
